package vip.meeet.algorithm.str;



public class Num9 {

    public static void main(String[] args) {
        System.out.println(isPalindrome(-10));
        System.out.println(isPalindrome(10));
        System.out.println(isPalindrome(12321));
        System.out.println(isPalindrome(123321));
        System.out.println(isPalindrome(123421));
    }

    public static boolean isPalindrome(int x) {
        if(x < 0){
            return false;
        }
        if(x < 10){
            return true;
        }
        String num = String.valueOf(x);
        int len = num.length();
        for(int i=0;i<len/2;i++){
            if(num.charAt(i) != num.charAt(len - i - 1)){
                return false;
            }
        }
        return true;
    }


}
